﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="AiXiu.WebSite.Register" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>注册</title>
    <link href="Content/mui/css/mui.min.css" rel="stylesheet" />
    <link href="Css/Register.css" rel="stylesheet" />
    <script src="Content/jquery-3.6.0.min.js"></script>

    <script>
        function yzmEven(obj, args) {
            $.post(
                "Handler/YZM.ashx",
                { 'yzm': args.Value },
                function (flag) {
                    args.IsValid = flag;
                    $("#CustomValidator1").css("visibility", flag ? "hidden" : "visible");
                    
                },"json"
            );


            //$.ajax({
            //    url: "Handler/aa.ashx",
            //    data: { 'yzm': args.Value },
            //    type: 'post',
            //    dataType: 'json',
            //    success: function (flag) {
            //        args.IsValid = flag;
            //        $("#CustomValidator1").css("visibility", flag ? "hidden" : "visible");
            //        console.log(args.IsValid);
            //    },
            //    error: function () {
            //        alert("error");
            //    }
            //});
            //args.IsValid = false;
        }
    </script>
</head>
<body>
    <form id="login_form" runat="server">
        <div class="mui-card">
            <!--内容区-->
            <div class="mui-card-content">
                <div class="mui-input-group">
                    <small class="small-title">用户名</small>
                    <asp:RequiredFieldValidator style="top: -1px;" ID="RequiredFieldValidator1" class="errormsg" runat="server" ErrorMessage="用户名不能为空" ControlToValidate="txtAccount" Display="Dynamic"></asp:RequiredFieldValidator>
                    <div class="mui-input-row">
                        <asp:TextBox ID="txtAccount" class="mui-input-clear mui-input" placeholder="请输入用户名" runat="server"></asp:TextBox>
                    </div>
                    <small class="small-title">手机号</small>
                    <asp:RequiredFieldValidator style="top: 71px;" class="errormsg" ID="RequiredFieldValidator2" runat="server" ErrorMessage="手机号码不能为空" ControlToValidate="txtMobile"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator style="top: 71px;" class="errormsg" ID="RegularExpressionValidator1" runat="server" ErrorMessage="手机号不合法" ControlToValidate="txtMobile" ValidationExpression="^1[356789]\d{9}$"></asp:RegularExpressionValidator>
                    <div class="mui-input-row">
                        <asp:TextBox ID="txtMobile" class="mui-input-clear mui-input" placeholder="请输入手机号码" runat="server"></asp:TextBox>
                    </div>
                    <small class="small-title">密码</small>
                    <asp:RequiredFieldValidator style="top: 143px;" class="errormsg" ID="RequiredFieldValidator3" runat="server" ErrorMessage="密码不能为空" ControlToValidate="txtPassword" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator style="top: 143px;" class="errormsg" ID="RegularExpressionValidator2" runat="server" ErrorMessage="请输入6-20位字母数字组合密码" ControlToValidate="txtPassword" ValidationExpression="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$"></asp:RegularExpressionValidator>
                    <div class="mui-input-row">
                        <asp:TextBox ID="txtPassword" class="mui-input-password mui-input" placeholder="请输入密码" runat="server" TextMode="Password"></asp:TextBox>
                    </div>
                    <small class="small-title">验证码</small>
                    <asp:RequiredFieldValidator style="top: 215px;" class="errormsg" ID="RequiredFieldValidator4" runat="server" ErrorMessage="验证码不能为空" ControlToValidate="txtYanZhengMa" Display="Static"></asp:RequiredFieldValidator>
                    <asp:CustomValidator style="top: 215px;" class="errormsg" ID="CustomValidator1"  runat="server" ErrorMessage="验证码错误" ClientValidationFunction="yzmEven" ControlToValidate="txtYanZhengMa" ></asp:CustomValidator>
                    <div class="mui-input-row">
                        <asp:TextBox ID="txtYanZhengMa" class=" mui-input" placeholder="请输入验证码" runat="server"></asp:TextBox>
                        <asp:Image ID="imgYanZhengMa" ImageUrl="~/Handler/CaptchaHandler.ashx" runat="server" />
                    </div>
                </div>
            </div>
            <!--页脚，放置补充信息或支持的操作-->
            <div class="mui-card-footer" runat="server">
                <asp:HiddenField ID="IsRegister" Value="false" runat="server" />
                <asp:Button ID="register_btn" data-loading-text="正在注册" class="mui-btn mui-btn-primary mui-btn-outlined" runat="server" Text="免费注册" ForeColor="White" OnClick="register_btn_Click" />
                <p class="mui-row">已有账号？<a id='login' href="Login.aspx" >现在登录</a></p>
            </div>
        </div>
    </form>

    <script src="Content/mui/js/mui.min.js"></script>
    <script>
        mui.init();
        $(function () {
            var src = $("#imgYanZhengMa").attr("src");
            var yzmid = 1;
            $("#imgYanZhengMa").click(function () {
                $(this).attr("src", src+"?xx="+yzmid++);
            });
        });
    </script>
</body>
</html>
